{% load account_nav %}

<li class="changeset">
{% for changeset in changesets %}

  {% if show_asset_name %}{% ifchanged %}
    <p class="change-asset-name">
       {{ changeset.asset|escape }}
       {% if changeset.asset.target %}
         <a href="/stats/{{ changeset.asset.target.path|urlencode|escape }}">(stats)</a>
       {% endif %}
    </p>
  {% endifchanged %}{% endif %}

  <p class="change-heading">
    <span class="change-detail">
      #{{ changeset.id }}{% if changeset.remote_addr and request.user.is_staff %}, from {{ changeset.remote_addr }}{% endif %}
    </span>
    {% person changeset.user %} on <span class="timestamp">{{ changeset.time|date:"Y-m-d @ H:i T"  }}</span>
  </p>
  <ul class="change-items">
     {% for item in changeset.items.all|dictsort:"field" %}
     <li class="change-item">
       <img src="{{ item.get_icon }}" width="16" height="16" />
       <span class="description">{{ item.get_description|capfirst|escape }}</span>{% if item.new_value or item.old_value %}:
         {% if item.is_multiline %}
            {% for chunk in item.get_diff %}
              <div class="diff">
                {% for line in chunk %}
                  <div class="diff-{{ line.style }}"><span class="diff-prefix">{{ line.prefix }}</span>{{ line.text }}&nbsp;</div>
                {% endfor %}
              </div>
            {% endfor %}
         {% else %}
            {{ item.old_value_display }} &rarr; {{ item.new_value_display }}
         {% endif %}
       {% endif %}
     </li>
     {% endfor %}
  </ul>
</li>
{% endfor %}
